<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>空间分析服务-缓冲区分析</title>

    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://cdn.bootcss.com/leaflet/1.0.3/leaflet.css">
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>

<script type="text/javascript" src="http://cdn.bootcss.com/leaflet/1.0.3/leaflet.js"></script>
<script type="text/javascript" src="../../dist/iclient9-leaflet.min.js"></script>
<script type="text/javascript">
    var map, roadLine, dsBufferAnalystService, dsBufferAnalystParameters, resultLayer,
            baseUrl = "http://support.supermap.com.cn:8090/iserver/services/map-changchun/rest/maps/长春市区图",
            serviceUrl = "http://support.supermap.com.cn:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst";
    map = L.map('map', {
        crs: L.CRS.NonEarthCRS({
            bounds: L.bounds([48.4, -7668.25], [8958.85, -55.58]),
            origin: L.point(48.4, -55.58)
        }),
        center: [-3375, 5105],
        maxZoom: 18,
        zoom: 6
    });
    L.supermap.tiledMapLayer(baseUrl, {noWrap: true}).addTo(map).on("load", function () {
        bufferAnalystProcess();
    });

    function bufferAnalystProcess() {
        roadLine = L.polyline([
            [-3337.3849141502124, 4933.319287022352],
            [-3349.3316322355736, 4960.9674060199022],
            [-3358.8890067038628, 5006.0235999418364],
            [-3378.0037556404409, 5075.3145648369318],
            [-3376.9669111768926, 5305.19551436013]
        ]).addTo(map);
        dsBufferAnalystService = L.supermap.spatialAnalystService(serviceUrl);
        dsBufferAnalystParameters = new SuperMap.DatasetBufferAnalystParameters({
            dataset: "RoadLine2@Changchun",
            filterQueryParameter: new SuperMap.FilterParameter({
                attributeFilter: "NAME='团结路'"
            }),
            bufferSetting: new SuperMap.BufferSetting({
                endType: SuperMap.BufferEndType.ROUND,
                leftDistance: {value: 10},
                rightDistance: {value: 10},
                semicircleLineSegment: 10
            })
        });
        dsBufferAnalystService.bufferAnalysis(dsBufferAnalystParameters, function (serviceResult) {
            var result = serviceResult.result;
            resultLayer = L.geoJSON(result.recordset.features, {color: "red"}).addTo(map);
        });

    }
</script>
</body>
</html>